<%@ include file="config.jsp" %>

<html>
<head>
<title>PORTEIRO</title>
</head>
    <body>
    	<div id="header">
			<%@ include file="header.jsp" %>
    	</div>	  
    	<div id="menu">
			<%@ include file="menu.jsp" %>
    	</div>	  
    	<div id="body">
    	<div class=error>
    		<ul>
		   		<c:forEach var="error" items="${errors}" > 
					<li>${error}</li>		   			
		   		</c:forEach>
    		</ul>
    	
    	
    	</div>
		<div class=message>${message}</div>
			<fieldset>
				<legend>Busca Porteiro</legend>
				<form method="post" name="searchPorteiro" action="${pageContext.request.contextPath}/searchporteiro">
					<label>Nome do porteiro</label>
					<input type="text" name="name" size="30" maxlength="50">
					
					<input type="submit" value="buscar">
				</form>
			</fieldset>
			<c:if test="${funcionarios.size() > 0}">
				<div id="result">
						<table>
							<thead>
								<tr>
									<td>Codigo Porteiro</td>
									<td>Data Adimissao</td>
									<td>Nome</td>
									<td>Horario de Entrada</td>
									<td>Horario de Saida</td>
									<td></td>
								</tr>
							</thead>
							<tbody>
						<c:forEach var="funcionario" items="${funcionarios}" > 
						<form method="post" action="${pageContext.request.contextPath}/updateporteiro">
								<tr>
									<td>
										${funcionario.codigo}
										<input type="hidden" name="codigo" value="${funcionario.codigo}"/>
									</td>
									<td><fmt:formatDate value="${funcionario.dataAdimissao}" pattern="dd/MM/yyyy"/></td>
									<td>${funcionario.nome}</td>
									<td> <input type="text" maxlength="5" size="8" name="horarioEntrada" value="${funcionario.horarioEntrada}"/> </td>
									<td><input type="text" maxlength="5" size="8" name="horarioSaida" value="${funcionario.horarioSaida}"/></td>
									<td><input type="submit" name="btnUpdateHorarioPorteiro" value="Atualizar"/></td>
								</tr>
						</form>
						</c:forEach>
							</tbody>
						</table>
				</div>
			</c:if>
			
    	</div>	  
    	<div id="footer">
			<%@ include file="footer.jsp" %>
    	</div>	  
		      
    </body>  
</html>